#ifndef LISTWIDGET_H
#define LISTWIDGET_H

#include <QWidget>
#include <QListView>
#include <QMouseEvent>
#include <QScrollBar>
#include <QScroller>
#include <QTimer>
#include "config.h"

class ListView : public QListView
{
    Q_OBJECT
public:
    ListView(QWidget *parent=0);
    QPoint              pressPos;
    bool                isMove = false;
    bool                isPress = true;
    bool                isClick = false;
    QTimer              *timer = nullptr;
    void mouseMoveEvent(QMouseEvent *)override;
    void mousePressEvent(QMouseEvent *e)override;
    void mouseReleaseEvent(QMouseEvent *e)override;

    bool                isScrolling = false;
    bool                itemPress   = false;
    bool                isLongPress = false;
signals:
    void qpressEvent();
    void qmoveEvent();
    void qreleaseEvent();
    void longPress();
    void ItemClick(const QModelIndex);

private slots:
    void stateChanged(QScroller::State newstate);
    void clicked(const QModelIndex &index);
};


#endif // LISTWIDGET_H
